import { request } from "@/utils/axios";
import { mockUrlPrefix } from "@/api/baseUrl";

export function getRoleList({ current: pageNum, ...rest }) {
  const params = {
    pageNum,
    ...rest,
  };
  return request({
    url: `${mockUrlPrefix}/api/system/role/list`,
    method: "get",
    params,
  });
}

export function getRole() {
  return request({
    url: `${mockUrlPrefix}/api/system/role`,
    method: "get",
  });
}

export function addRole(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/role`,
    method: "post",
    data,
  });
}

export function updateRole(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/role`,
    method: "put",
    data,
  });
}

export function deleteRole(id) {
  return request({
    url: `${mockUrlPrefix}/api/system/role?id=${id}`,
    method: "delete",
  });
}
